/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.lucava.boatskeeper.server.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author glenn
 */
@Entity
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Boat.findAll", query = "SELECT b FROM Boat b"),
    @NamedQuery(name = "Boat.findByBoatId", query = "SELECT b FROM Boat b WHERE b.boatId = :boatId"),
    @NamedQuery(name = "Boat.findByBoatName", query = "SELECT b FROM Boat b WHERE b.boatName = :boatName"),
    @NamedQuery(name = "Boat.findByLongitude", query = "SELECT b FROM Boat b WHERE b.longitude = :longitude"),
    @NamedQuery(name = "Boat.findByLatitude", query = "SELECT b FROM Boat b WHERE b.latitude = :latitude"),
    @NamedQuery(name = "Boat.findByBoatImage", query = "SELECT b FROM Boat b WHERE b.boatImage = :boatImage")})
public class Boat implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "boat_id")
    private Short boatId;
    @Size(max = 255)
    @Column(name = "boat_name")
    private String boatName;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    private Float longitude;
    private Float latitude;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "boat_image")
    private String boatImage;
    @JoinColumn(name = "category_id", referencedColumnName = "category_id")
    @ManyToOne(optional = false)
    private Category categoryId;

    public Boat() {
    }

    public Boat(Short boatId) {
        this.boatId = boatId;
    }

    public Boat(Short boatId, String boatImage) {
        this.boatId = boatId;
        this.boatImage = boatImage;
    }

    public Short getBoatId() {
        return boatId;
    }

    public void setBoatId(Short boatId) {
        this.boatId = boatId;
    }

    public String getBoatName() {
        return boatName;
    }

    public void setBoatName(String boatName) {
        this.boatName = boatName;
    }

    public Float getLongitude() {
        return longitude;
    }

    public void setLongitude(Float longitude) {
        this.longitude = longitude;
    }

    public Float getLatitude() {
        return latitude;
    }

    public void setLatitude(Float latitude) {
        this.latitude = latitude;
    }

    public String getBoatImage() {
        return boatImage;
    }

    public void setBoatImage(String boatImage) {
        this.boatImage = boatImage;
    }

    public Category getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Category categoryId) {
        this.categoryId = categoryId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (boatId != null ? boatId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Boat)) {
            return false;
        }
        Boat other = (Boat) object;
        if ((this.boatId == null && other.boatId != null) || (this.boatId != null && !this.boatId.equals(other.boatId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.lucava.boatskeeper.server.entity.Boat[ boatId=" + boatId + " ]";
    }
    
}
